﻿using Dubbo.Rpc.Proxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Dubbo.Rpc.Builder
{
    public class ServerBuilder
    {
        private static IProxyFactory proxyFactory = new TransparentProxyFactory();

        private string name;
        private string protocol;
        private IPEndPoint addr;

        public ServerBuilder()
        {
        }

        public ServerBuilder Name(string name)
        {
            this.name = name;
            return this;
        }

        public ServerBuilder Protocol(string protocol)
        {
            this.protocol = protocol;
            return this;
        }

        public ServerBuilder Bind(IPEndPoint addr)
        {
            this.addr = addr;
            return this;
        }

        public void Buid<T>(T service)
        {
            IInvoker<T> invoker = proxyFactory.GetInvoker(service, new URL(this.protocol, addr));

            //IExporter<T> exporter = protocol.Export(invoker);
        }
    }
}
